package com.ti.demo.configuration;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.deepseek.DeepSeekChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: com.ti.demo.configuration
 * @Author Triagen
 * @Date 2025/7/18 11:12
 */
@Configuration
public class ChatClientConfiguration {

    /**
     * a manual ChatClient example,for better understanding of api, model and chatClient
     * generally speaking, api includes the connection info, model includes the model choice, and chatClient is the assembly of both
     *
     * @param deepSeekChatModel
     * @return
     */
    @Bean("chatClient")
    public ChatClient chatClient(DeepSeekChatModel deepSeekChatModel) {
        return ChatClient.builder(deepSeekChatModel)
                .defaultAdvisors(
                        SimpleLoggerAdvisor.builder().build()
                )
                .build();
    }

}
